import React from 'react'
// ===================================================================== Temp
import FormModal from '#cpt/temp/FormModal'
// ===================================================================== global declare
const { $fn } = window
// ===================================================================== Lazy
const type = [
	{name:'标本信息不属于该医院',	value:'63004'},
	{name:'优惠差额',				value:'63001'},
	{name:'作废',					value:'63003'},
	{name:'修改实际金额',			value:'63002'},
	{name:'现金收讫',				value:'63005'},
]
// ===================================================================== component
class Index extends React.Component{
	state = {
		data:[],
		pag: {},
		selectedKeys:[],
		//修改账期
		formData:[
			{ label: '异常状态',		name: 'type',  			type: 'select',	required:true,half:true ,data:type, onValue:({value,formData})=>{
				if(value === '63003'){
					this.formRef.setValue({price:this.price})
					$fn.disabledRows(formData,'price',true)
				}else if(value === '63005'){
					this.formRef.setValue({price:'0'})
					$fn.disabledRows(formData,'price',false)
				}else{
					this.formRef.reset(['price'])
					$fn.disabledRows(formData,'price',false)
				}
				this.setState({formData})
			} },
			{ label: '价格',		name: 'price',			required:true ,half:true },
			{ label: '异常备注',		name: 'remark', 		type: 'textarea', required:true ,full:true},
			{ label: '图片',		name: 'pic_path', 		type: 'upload'},
		]
	}
	
	model = {}
	
	open = rows => {
		this.modal.open({ formRef:this.formRef })
		this.price = rows[0].price
		this.submit = { ids: rows.map(v=>v.uuid) }
	}

	render(){
		return FormModal.call(this,{ title:'账单异常', api: 'bill/salesmanabnormal' })
	}
}

export default Index